<script setup lang="ts">
import { ArrowRight, Expand, Grid } from '@element-plus/icons-vue'
import { reactive } from 'vue'

// do not use same name with ref
const form = reactive({
    name: '',
    sex: '',
    date1: '',
    date2: '',
    job: '',
    dname: '',
    state: '在职',

})

const tableData = [
    {
        deptno: '101',
        dname: '商用软件事业部',
        sex: '男',
        state: '在职',
        empno: '1001',
        ename: '赵四',
        job: '工程师',
        method: '正常A班'
    },
    {
        deptno: '101',
        dname: '商用软件事业部',
        sex: '男',
        state: '离职',
        empno: '1001',
        ename: '赵四',
        job: '工程师',
        method: '正常A班'
    },
    {
        deptno: '101',
        dname: '商用软件事业部',
        sex: '男',
        state: '在职',
        empno: '1001',
        ename: '赵四',
        job: '工程师',
        method: '正常A班'
    },
    {
        deptno: '101',
        dname: '商用软件事业部',
        sex: '男',
        state: '离职',
        empno: '1001',
        ename: '赵四',
        job: '工程师',
        method: '正常A班'
    },
]
const onSubmit = () => {
    console.log('submit!')
}
</script>
<template>
    <div class="head">员工信息管理</div>
    <div class="bread">
        <el-breadcrumb :separator-icon="ArrowRight">
            <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item :to="{ path: '/eim' }">时间管理</el-breadcrumb-item>
            <el-breadcrumb-item :to="{ path: '/eim' }">员工信息管理</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <div class="body">
        <div class="l1">
            <el-form :model="form" label-width="auto" style="max-width: 600px">
                <el-form-item label="姓名">
                    <el-input v-model="form.name" />
                </el-form-item>
                <el-form-item label="性别">
                    <el-select v-model="form.sex" placeholder="please select your zone">
                        <el-option label="男" value="male" />
                        <el-option label="女" value="female" />
                    </el-select>
                </el-form-item>
                <el-form-item label="入职日期">
                    <el-col :span="11">
                        <el-date-picker v-model="form.date1" type="date" placeholder="Pick a date"
                            style="width: 100%" />
                    </el-col>
                    <el-col :span="2" class="text-center">
                        <span class="text-gray-500">-</span>
                    </el-col>
                    <el-col :span="11">
                        <el-date-picker v-model="form.date2" type="date" placeholder="Pick a date"
                            style="width: 100%" />
                    </el-col>
                </el-form-item>
                <el-form-item label="职位">
                    <el-select v-model="form.job" placeholder="please select your zone">
                        <el-option label="软件工程师" value="a" />
                        <el-option label="高级软件工程师" value="b" />
                    </el-select>
                </el-form-item>
                <el-form-item label="部门">
                    <el-select v-model="form.dname" placeholder="please select your zone">
                        <el-option label="商用软件事业部" value="a" />
                        <el-option label="金融软件事业部" value="b" />
                    </el-select>
                </el-form-item>
                <el-form-item label="状态">
                    <el-select v-model="form.state" placeholder="please select your zone">
                        <el-option label="在职" value="a" />
                        <el-option label="离职" value="b" />
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="onSubmit">查询</el-button>
                    <el-button>重置</el-button>
                </el-form-item>
            </el-form>
        </div>
        <div><el-button type="primary" round><el-icon>
                    <Plus />
                </el-icon>新增</el-button></div>
        <div class="l2">

            <el-table :data="tableData" style="width: 100%">
                <el-table-column fixed prop="empno" label="编号" width="150" />
                <el-table-column prop="ename" label="姓名" width="120" />
                <el-table-column prop="sex" label="性别" width="120" />
                <el-table-column prop="job" label="职位" width="120" />
                <el-table-column prop="dname" label="部门" width="180" />
                <el-table-column prop="state" label="状态" width="120" />
                <el-table-column fixed="right" label="操作" min-width="120">
                    <template #default="scope">
                        <el-button type="primary" round><el-icon>
                                <Plus />
                            </el-icon>查看</el-button>
                        <el-button type="warning" round><el-icon>
                                <Plus />
                            </el-icon>修改</el-button>
                        <el-button v-if="scope.row.state === '在职'" type="danger" round><el-icon>
                                <Minus />
                            </el-icon>离职</el-button>
                        <el-button v-else-if="scope.row.state === '离职'" type="primary" round><el-icon>
                                <Plus />
                            </el-icon>入职</el-button>
                        <el-button type="success" round><el-icon>
                                <Plus />
                            </el-icon>调转</el-button>

                    </template>
                </el-table-column>
            </el-table>
        </div>

    </div>
</template>

<style scoped>
.l1 {
    padding: 40px;
    line-height: 60px;
    width: 100%;
    /* height: 60px; */
    /* border: 1px solid #000; */
    padding: 10px;
}

.l2 {
    width: 100%;
    /* background-color: #111; */
    height: 76px;
    display: flex;
    justify-content: center;
    padding: 20px;

}

.head {
    height: 30px;
    background-color: rgb(255, 255, 255);
    line-height: 30px;
    font-size: 30px;
    padding: 25px;
    color: #000;
}

.bread {
    height: 30px;
    background-color: rgb(215, 215, 215);
    padding-top: 20px;
    padding-left: 20px;
    vertical-align: bottom;
}

.body {
    width: 100%;
    /* height: 100%; */
    background-color: rgb(255, 255, 255);
    padding: 0;
}
</style>